DFLAGS := -llapack -lblas -lflann -llz4
CPP := g++ -O
CC  := gcc -O
GDALLIB := $(shell gdal-config --libs )
GDALINC := $(shell gdal-config --cflags )
INC := -I. -I./include
SRCS := $(wildcard lib/*.cc)
DEPS := $(patsubst %.cc, %.o, $(SRCS))
PROGS := $(wildcard *.cc)
PROGDEPS := $(patsubst %.cc, %.o, $(PROGS))

all: $(PROGDEPS) $(DEPS)
	$(CPP) -o learn_cont learn_cont.o $(DEPS) $(DFLAGS) $(GDALLIB)
	$(CPP) -o DS_mv_cont_fast DS_mv_cont_fast.o $(DEPS) $(DFLAGS) $(GDALLIB)

tools: $(PROGDEPS) $(DEPS)

.cc.o:
	$(CPP) -c -o $@ $< $(INC) $(GDALINC) $(CFLAGS)
.c.o:
	$(CC) -c -o $@ $< $(INC)
clean:
	-find ./ -name "*.o"|xargs rm
	-find ./ -name "*~"|xargs trash
	-rm DS_mv_cont_fast learn_cont
indent:
	find ./ -name "*.cc" -exec indent  -kr -i4 -ts4 -bl -bli0 -sob -nce {} \;
	find ./ -name "*.cc" -exec sed -i "s/\t/    /g" {} \;
	find ./ -name "*.h" -exec indent  -kr -i4 -ts4 -bl -bli0 -sob -nce {} \;
	find ./ -name "*.h" -exec sed -i "s/\t/    /g" {} \;
ctags:

